import request from "../utils/request.js";

class StarSign{
  constructor() {
  }

  async fortune(req, res, next) {
    const { consName, type, key } = req.query;
    let url = 'http://web.juhe.cn:8080/constellation/getAll';

    let response;
    try {
      response = await request({
        url: url,
        method: "get",
        params: {
          key:'91665a8e1576c946b4655964831f9975',
          consName,
          type,
        }
      });
      console.log(response);
      res.send({
        code: 200,
        result: response
      });
    } catch (err) {
      console.log('fortune error',err);
      res.send({
        code: 201,
        message: '星座运势获取失败'
      });
      return;
    }
  }
}

export default new StarSign();